<extend name="Public/base" />

<block name="body">
	<!-- 标题栏 -->
	<div class="main-title">
		<h2>订单列表</h2>
	</div>
	<div class="cf">
		<div class="fl">
            <a class="btn" href="{:U('add')}">新增订单</a>
            <!-- <a id="exportdata" class="btn" href="{:U('exportdata')}" target-form="ids">导 出</a> -->
            <!-- <button class="btn ajax-post" url="{:U('changeStatus?method=forbidUser')}" target-form="ids">禁 用</button> -->
            <!-- <button class="btn ajax-post confirm" url="{:U('changeStatus?method=deleteOrder')}" target-form="ids">取消订单</button> -->
            <script type="text/javascript">
            $(function(){
            	$("#exportdata").click(function(){
            		ids=$(".ids").serialize();

            		href="/admin.php?s=/Order/exportdata";
            		if(ids){
            			href+=("&"+ids);
            			// alert(href);
            			window.location.href=href;
            		}else{
            			alert("请选择要导出的订单！");
            		}
            		return false;
            	});
            })
            </script>
        </div>

        <!-- 高级搜索 -->
		<div class="search-form fr cf" style="background-color: transparent;">
        <label style="float: left;font-size: 18px;">订单状态：</label>	
			<div class="sleft">
				<form action="">
				 <select id="status" style="float: right;">
				 	<option value="">未选择</option>
				    <option value="0">未审核</option>
				    <option value="1">已审核</option>
				    <option value="2">已开方</option>
				    <option value="3">已划价</option>
				    <option value="4">已备料</option>
				    <option value="5">已生产</option>
				    <option value="6">已发货</option>
				    <option value="7">已完成</option>
				  </select>
				<!-- <a class="sch-btn" href="javascript:;" id="search" url="{:U('index')}"><i class="btn-search"></i></a> -->
			</form>
			</div>
		</div>
		<div class="search-form fr cf">
			<div class="sleft">
				<input type="text" name="patient_name" class="search-input" value="{:I('patient_name')}" placeholder="请输入会员姓名或者订单ID">
				<a class="sch-btn" href="javascript:;" id="search" url="{:U('index')}"><i class="btn-search"></i></a>
			</div>
		</div>
    </div>
    <!-- 数据列表 -->
    <div class="data-table table-striped">
	<table class="">
    <thead>
        <tr>
		<th class="row-selected row-selected"><input class="check-all" type="checkbox"/></th>
		<th class="">订单编号</th>
		<th class="">会员昵称</th>
		<th class="">患者姓名</th>
		<th class="">性别</th>
		<th class="">联系方式</th>
		<!-- <th class="">最后登录IP</th> -->
		<th class="">状态</th>
		<th class="">操作</th>
		</tr>
    </thead>
    <tbody>
		<notempty name="_list">
		<volist name="_list" id="vo">
		<tr>
            <td><input class="ids" type="checkbox" name="id[]" value="{$vo.id}" /></td>
			<td>{$vo.id} </td>
			<td>{:get_nickname($vo[uid])} </td>
			<td><a href="{:U('Order/edit?id='.$vo['id'])}" class="confirm">{$vo.patient_name}</a></td>
			<td>{$vo.gender}</td>
			<td>{$vo.phone}</td>
			<!-- <td><span>{$vo.last_login_time|time_format}</span></td> -->
			<!-- <td><span>{:long2ip($vo['last_login_ip'])}</span></td> -->
			<td>{$vo.status}</td>
			<td><eq name="vo.status" value="1">
				<a href="{:U('User/changeStatus?method=forbidUser&id='.$vo['uid'])}" class="ajax-get">禁用</a>
				<else/>
				<!-- <a href="{:U('User/changeStatus?method=resumeUser&id='.$vo['uid'])}" class="ajax-get">启用</a> -->
				</eq>
				<!-- <a href="{:U('AuthManager/group?uid='.$vo['uid'])}" class="authorize">授权</a> -->
                <a href="{:U('Order/edit?id='.$vo['id'])}" class="confirm">编辑</a>
                <a href="{:U('Order/changeStatus?method=deleteorder&id='.$vo['id'])}" class="confirm">取消订单</a>
                <!-- <a href="{:U('User/changePoint?uid='.$vo['uid'])}" class="confirm">充值</a> -->
                </td>
		</tr>
		</volist>
		<else/>
		<td colspan="9" class="text-center"> aOh! 暂时还没有内容! </td>
		</notempty>
	</tbody>
    </table>
	</div>
    <div class="page">
        {$_page}
    </div>
</block>

<block name="script">
	<script src="__STATIC__/thinkbox/jquery.thinkbox.js"></script>

	<script type="text/javascript">

	$("#status").change(function(){
		window.location.href="?s=/order/index/value/"+$(this).val();
	});
	$(function(){
		var sel="{$val}";
		if(sel!="")
			$('#status').val(sel);

	});

	//搜索功能
	$("#search").click(function(){
		var url = $(this).attr('url');
        var query  = $('.search-form').find('input').serialize();
        query = query.replace(/(&|^)(\w*?\d*?\-*?_*?)*?=?((?=&)|(?=$))/g,'');
        query = query.replace(/^&/g,'');
        if( url.indexOf('?')>0 ){
            url += '&' + query;
        }else{
            url += '?' + query;
        }
		window.location.href = url;
	});
	//回车搜索
	$(".search-input").keyup(function(e){
		if(e.keyCode === 13){
			$("#search").click();
			return false;
		}
	});
    //导航高亮
    highlight_subnav('{:U('User/index')}');
	</script>
</block>
